// javascript function to deal with form
// please keep these lines on when you copy the source
// made by: Phuwarin Supawarapong, 2004

function initForm(field) {
  // set first focus.
  field.focus();
}

function checkRequired(which) {
  var pass=true;
  if (document.images) {
    for (i=0;i<which.length;i++) {
      var tempobj=which.elements[i];
      if (tempobj.name.substring(0,8)=="required") {
        if (((tempobj.type=="text"||tempobj.type=="textarea")&&
          tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
          tempobj.selectedIndex==0)) {
          pass=false;
          break;
        }
      }
    }
  }

  if (!pass) {
    tempobj.focus();
    shortFieldName=tempobj.name.substring(8,30).toUpperCase();
    alert("Please make sure the "+shortFieldName+" field was properly completed.");
    return false;
  }
  else
    return true;
}

function numericOnly() {
  if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;
}

function AlphaNumeric() {
  if ((event.keyCode < 32) || ((event.keyCode > 32) && (event.keyCode < 48))
  || ((event.keyCode > 57) && (event.keyCode < 65)) || ((event.keyCode > 90) && (event.keyCode < 95)) 
  || ((event.keyCode > 95) && (event.keyCode < 97)) || (event.keyCode > 122)) event.returnValue = false;
}
